﻿Public Class ProjectMember
    Implements IObject

    Private id As Integer
    Private availableFromDate As Date
    Private availableToDate As Date
    Private resource As Resource
    Private project As Project
    Private projectMemberRole As ArrayList

    Public Sub New()
        projectMemberRole = New ArrayList
    End Sub

    Public Sub New(ByVal id As Integer)
        Me.id = id
        projectMemberRole = New ArrayList
    End Sub

    Public Sub New(ByVal project As Project)
        Me.project = project
        projectMemberRole = New ArrayList
    End Sub

    Public Sub New(ByVal resource As Resource)
        Me.resource = resource
        projectMemberRole = New ArrayList
    End Sub

    Public Sub New(ByVal id As Integer, ByVal availableFromDate As Date, ByVal availableToDate As Date, ByRef resource As Resource, ByRef project As Project, ByVal createDate As Date, ByRef state As State)
        Me.id = id
        Me.availableFromDate = availableFromDate
        Me.availableToDate = availableToDate
        Me.resource = resource
        Me.project = project
        projectMemberRole = New ArrayList
    End Sub

    Public Property idProperty() As Integer
        Get
            Return Me.id
        End Get
        Set(ByVal value As Integer)
            Me.id = value
        End Set
    End Property

    Public Property availableFromDateProperty() As Date
        Get
            Return Me.availableFromDate
        End Get
        Set(ByVal value As Date)
            Me.availableFromDate = value
        End Set
    End Property

    Public Property availableToDateProperty() As Date
        Get
            Return Me.availableToDate
        End Get
        Set(ByVal value As Date)
            Me.availableToDate = value
        End Set
    End Property


    Public Property resourceProperty() As Resource
        Get
            Return Me.resource
        End Get
        Set(ByVal value As Resource)
            Me.resource = value
        End Set
    End Property

    Public Property projectProperty() As Project
        Get
            Return Me.project
        End Get
        Set(ByVal value As Project)
            Me.project = value
        End Set
    End Property

    Public Property projectMemberRoleProperty() As ArrayList
        Get
            Return Me.projectMemberRole
        End Get
        Set(ByVal value As ArrayList)
            Me.projectMemberRole = value
        End Set
    End Property

    Public Function getTableName() As String Implements IObject.getTableName
        Return "PROJECT_MEMBERS"
    End Function

    Public Function getId() As Integer Implements IObject.getId
        Return id
    End Function

    'other methods...
    Public Overrides Function GetHashCode() As Integer
        Return Me.resourceProperty.idProperty
    End Function

    'Declaration
    Public Overrides Function Equals(ByVal obj As Object) As Boolean
        Dim returnValue As Boolean

        returnValue = Me.Equals(obj)
    End Function

End Class
